//@author A0096794H
#include "DeadlineTask.h"

DeadlineTask::DeadlineTask(string description,Date deadline) : Task(description)
{
	type= DEADLINE;
	dueDate=deadline;
	dueTime = NULL_TIME;
	taskParameterCounter=2;
}

DeadlineTask::DeadlineTask(string desc, Date deadlineDate, Time deadlineTime) : Task(desc)
{
	type = DEADLINE;
	dueDate = deadlineDate;
	dueTime = deadlineTime;
	taskParameterCounter=3;
}

Date DeadlineTask::getDueDate()
{
	return dueDate;
}

Time DeadlineTask::getDueTime()
{
	return dueTime;
}

ResultType DeadlineTask::setDueDate(Date date)
{
	dueDate = date;
	return SUCCESS;
}

ResultType DeadlineTask::setDueTime(Time time)
{
	dueTime = time;
	return SUCCESS;
}

//@author A0099619J
string DeadlineTask::stringify()
{
	stringstream text;
	text << DEADLINE << "," << description << ","
	<< dueDate<<","<<dueTime;
	saveDoneOrNotDone(text);
	return text.str();
}

string DeadlineTask::format()
{
	stringstream text;
	if(dueTime==NULL_TIME)
	{
		text << description << ", "
		<< dueDate.formatDate();
	}
	else{
		text << description << ", "
		 << dueDate.formatDate() << ", "
		 << dueTime.formatTime();
	}
	return text.str();
}